<!DOCTYPE html>
<html>
<head lang="zh-CN">
    <meta charset="UTF-8">
    <meta name="viewport" content=" initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <title>订单详情</title>
    <link href="{$Think.config.RESOURCEURL}wx_assets/css/common.css{$Think.config.RESOURCE_VER}" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="{$Think.config.RESOURCEURL}wx_assets/css/product/product_express.css" onerror="_cdnFallback(this)">
    <link rel="stylesheet" type="text/css" href="{$Think.config.RESOURCEURL}wx_assets/quan/orderDetail.css{$Think.config.RESOURCE_VER}" />
    <script type="text/javascript" src="{$Think.config.RESOURCEURL}wx_assets/js/zepto.1.1.3.min.js{$Think.config.RESOURCE_VER}"></script>
    <script src="{$Think.config.RESOURCEURL}wx_assets/js/util.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script src="{$Think.config.RESOURCEURL}wx_assets/js/wx_share.js{$Think.config.RESOURCE_VER}" type="text/javascript"></script>
    <style>
        body{
            background-color: #F5F5F5;
        }
    </style>
</head>
<body>
<div class="main">
    <div class="cont">
        <div class="detail">
            <volist name="productList" id="p">
                <dl class="ctent">
                    <dd>
                        <php>if($p['picUrl1']){
                            $p['picUrl1'] = json_decode($p['picUrl1'],true);
                        </php>
                        <img src="{$p['picUrl1'][1]['picUrl']}@90w_90h_100Q" onclick="orderDetail.toDetail('{$p.fromCustomerId}','{$p.pid}','{$qId}','{$p.sId}')"/>
                        <php>}else{</php>
                        <img src="{$p.picUrl}@90w_90h_100Q" onclick="orderDetail.toDetail('{$p.fromCustomerId}','{$p.pid}','{$qId}','{$p.sId}')"/>
                        <php>}</php>
                    </dd>
                    <dt>
                    <div class="wzz">
                        <a onclick="orderDetail.toDetail('{$p.fromCustomerId}','{$p.pid}','{$qId}','{$p.sId}')">{$p.name}</a>
                    </div>
                    <div class="specif">
                        <div class="tp">
                            <notempty name="p.firstSpecificName">
                                <span style="margin-right:15px;float:left">规格</span>
                                <a href="#">{$p.firstSpecificName}</a>
                            </notempty>
                            <notempty name="p.secSpecificName">
                                <a href="#">{$p.secSpecificName}</a>
                            </notempty>
                            <span>x{$p.count}</span>
                        </div>
                        <div class="btm">
                            <div class="money" style="display:inline-block">
                                金额:<span>￥
                                        {$p.price}
                                        </span>
                                <if condition="$uType eq '1' AND $miUid eq $uid">
                                     <span>(￥{$p.miAward})</span>
                                <elseif condition="$uid eq $refereeUid"/>
                                     <span>(￥{$p.refereeAward})</span>
                                <elseif condition="$uid eq $parentRefereeUid"/>
                                     <span>(￥{$p.parentRefereeAward})</span>
                                <else/>
                                    <span>(￥{$p.lordAward})</span>
                                </if>
                            </div>
                            <if condition="$p.isComment eq 0">
                                <a style="float:right;padding:2px 5px;position:relative;top:-2px;background-color:#e1027e;color:white;" onclick="orderDetail.toComment('{$id}','{$p.pid}')">去晒单</a>
                                <elseif condition="$p.isComment eq 1"/>
                                <a style="float:right;padding:2px 5px;position:relative;top:-2px;background-color:#e1027e;color:white;">已晒单</a>
                            </if>
                        </div>
                    </div>
                    </dt>
                </dl>
                <div class="route clearfix">
                    <div class="title">
                        密友:
                    </div>
                    <ul class="clearfix">
                        <li>
                            <img src="{$miUser.headImgUrl}" alt="" />
                            <span>{$miUser.nickName}</span>
                        </li>
                    </ul>
                </div>
                <div class="route clearfix">
                    <div class="title">
                        买家:
                    </div>
                    <ul class="clearfix">
                        <li>
                            <img src="{$buyUser.headimgurl}" alt="" />
                            <span>{$buyUser.nickname}</span>
                        </li>
                    </ul>
                </div>
            </volist>
            <div class="written">
                <ul>
                    <li>订单总额&nbsp;:&nbsp; <i>￥{$price}</i></li>
                    <li>订单状态&nbsp;:&nbsp; <i>
                        <notempty name="status">
                            <if condition="$status eq 'ok'">[交易成功]
                                <elseif condition="$status eq 'closed'"/>[交易关闭]
                                <elseif condition="$status eq 'paying'"/>[等待付款]
                                <elseif condition="$status eq 'delivering'"/>[等待发货]
                                <elseif condition="$status eq 'deliveringtostore'"/>[等待配送到自提点]
                                <elseif condition="$status eq 'delivered'"/>[已发货]
                                <elseif condition="$status eq 'deliveredtostore'"/>[已配送到自提点]
                                <elseif condition="$status eq 'notsubmit'" />[未提交]
                                <elseif condition="$status eq 'refund'"/>[已退款]
                                <elseif condition="$status eq 'refundedpart'"/>[已部分退款]
                                <elseif condition="$status eq 'refunding'"/>[退款中]
                                <elseif condition="$status eq 'payingconfirm'"/>[付款确认中]
                                <elseif condition="$status eq 'paypart'"/>[部分付款]
                                <elseif condition="$status eq 'partake'"/>[已参与夺宝]
                                <elseif condition="$status eq 'teaming'"/>[组团中]
                                <elseif condition="$status eq 'ordersign'"/>[已报名]
                                <elseif condition="$status eq 'confirmsign'"/>[已确认报名]
                                <elseif condition="$status eq 'canclesign'"/>[已取消报名]
                                <elseif condition="$status eq 'supported'"/>[众筹中]
                                <else />[状态错误]
                            </if>
                        </notempty>
                        <empty name="status">[未处理]</empty>
                        </dd>
                    </i>
                        <if condition="$isTeam eq '1'">
                            <style>
                                .teamDetail{
                                    float: right;
                                    background-color: #e1027e;
                                    color: white;
                                    padding: 4px 10px;
                                    border-radius: 4px;
                                    position: relative;
                                    top: -2px;
                                }
                            </style>
                            <a class="teamDetail" onclick="orderDetail.toTeamDetail()">组团详情</a>
                        </if>
                    </li>
                    <li>订单编号：{$serialNumber} </li>
                    <li>订单日期：{$updateTime} </li>
                </ul>
            </div>
        </div>
    </div>
    <div class="cont" id="expressDiv" style="display:none">
        <!--<div class="expressInfo">收件人：{$fullName}</div>-->
        <!--<div class="expressInfo"><span>收货地址：{$address}</span></div>-->
        <div class="express" id="express">
        </div>
    </div>

</div>
<script type="text/html" id="expressTpl">
    <div class="result-box" id="padding-box" style="padding-bottom: 59px; margin-bottom: 0;">
        <%if(Traces){%>
        <ul class="result-list" id="expressInfo">
            <%for(var i=0;i<Traces.length;i++){
            var info = Traces[i];%>
            <li >
                <dl class="col1">
                    <dt><%=timeFormat(info.AcceptTime,1)%></dt>
                    <dd><%=timeFormat(info.AcceptTime,0)%></dd>
                </dl>
                          <span class="col2">
                          <span class="line1"></span>
                          <span class="line2"></span>
                          <span class="point"></span>
                          </span>
                <span class="col3"><%=info.AcceptStation%></span>
            </li>
            <%}%>
        </ul>
        <%}%>
        <%if(batchTrack){%>
        <ul class="result-list">
            <%for(var i=0;i<batchTrack.length;i++){
            var track = batchTrack[i];%>
            <li >
                <dl class="col1">
                    <dt><%=timeFormat(track.createTime,1)%></dt>
                    <dd><%=timeFormat(track.createTime,0)%></dd>
                </dl>
                          <span class="col2">
                          <span class="line1"></span>
                          <span class="line2"></span>
                          <span class="point"></span>
                          </span>
                <span class="col3"><%=track.description%></span>
            </li>
            <%}%>
        </ul>
        <%}%>
    </div>

</script>
<script type="text/javascript">
    var baseUrl = '{$Think.config.SERVER_HOST}';
    var orderDetail={
        initExpress:function(){
            var expressName = '{$expressName}';
            var expressNo = '{$expressNo}';
            var oid = '{$id}';
            var status = '{$status}';
            $.req.get("call.json?module=product&customerId={$fromCustomerId}&method=productExpress",{
                params:{
                    "Express":expressName,
                    "orderNum":expressNo,
                    "oid":oid
                }
            },function(data){
                if(data){
                    if(status=='delivering'||status=='delivered'){
                        $("#expressDiv").show();
                    }
                    var html = template("expressTpl",data),
                            productUl = $("#express");
                    productUl.html(html);
                }
            });
        },
        toComment:function(oid,pid){
            var p=$.util.getParamAsObject();
            var params={
                "oid":oid,
                "pid":pid,
                "type":1,
                "uType":p.uType
            };
            params=encodeURIComponent(JSON.stringify(params));
            location.href= 'call.html?customerId={$fromCustomerId}&module=product&method=getcomment&params='+params;
        },
        getShareUrl:function(){
            var shareUrl="";
            var params={
                "qId":"{$qId}",
                "fromUId":"{$fromUId}"
            };
            params=encodeURIComponent(JSON.stringify(params));
            shareUrl=baseUrl+'call.html?customerId={$customerId}&module=quan&scope=1&method=shopIndex&params='+params;
            return shareUrl;
        },
        toDetail:function(formCustomerId,pId,qId){
            var p={
                qId:qId,
                id:pId
            };
            p=encodeURIComponent(JSON.stringify(p));
            var detailUrl=baseUrl+'call.html?customerId='+formCustomerId+'&module=product&method=getProduct&params='+p;
            location.href=detailUrl;
        },
        toTeamDetail:function(){
            var p={
                qId:'{$qId}',
                miUId:'{$miUId}',
                teamId:'{$teamId}'
            };
            p=encodeURIComponent(JSON.stringify(p));
            var detailUrl=baseUrl+'call.html?customerId={$fromCustomerId}&module=tuan&method=getView&params='+p;
            location.href=detailUrl;
        }
    };
    template.helper('timeFormat', function(data,status) {
        if(data.length>10){
            if(status){
                return data.substring(0,data.indexOf(" "));
            }else{
                return data.substr(data.indexOf(" "),6);
            }
        }else{
            if(status){
                return data;
            }
        }
    });
    orderDetail.initExpress();
    wx_share.init({
                "pkg":{
                    "appId": '{$pkg.appId}',
                    "timestamp": {$pkg.timestamp},
                "nonceStr": '{$pkg.nonceStr}',
                "signature": '{$pkg.signature}'
            },
            hide:1
    });
</script>
</body>
</html>